/*
 * Copyright (c) gitee.com/jiandong001.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

export const enum YogaUnit {
  UNDEFINED = 0,
  POINT = 1,
  PERCENT = 2,
  AUTO = 3,
}


export function getYogaUnitFromNumber(value: number): YogaUnit | never {
  switch (value) {
    case 0: return YogaUnit.UNDEFINED;
    case 1: return YogaUnit.POINT;
    case 2: return YogaUnit.PERCENT;
    case 3: return YogaUnit.AUTO;
    default: throw new Error("Unknown enum value: " + value);
  }
}



//export class YogaUnit {
//  public static UNDEFINED = 0
//  public static POINT = 1
//  public static PERCENT = 2
//  public static AUTO = 3
//
//  private readonly mIntValue: number;
//
//  constructor(intValue: number) {
//    this.mIntValue = intValue;
//  }
//
//  public intValue(): number {
//    return this.mIntValue;
//  }
//
//  public static fromNumber(value: number): number {
//    switch (value) {
//      case 0: return YogaUnit.UNDEFINED;
//      case 1: return YogaUnit.POINT;
//      case 2: return YogaUnit.PERCENT;
//      case 3: return YogaUnit.AUTO;
//      default: throw new Error("Unknown enum value: " + value);
//    }
//  }
//}
